package com.xiukelai.springboot.base;

/**
 * 给客户端返回数据的枚举
 * @author lixueju
 * @since  2019/3/14 8:19
 */
public enum ResultDataEnum implements IEnum {
    // 系统的未知错误，Exception
    SERVER_ERROR(99999, "请稍后重试"),
    SUCCESS(0, "成功" ),
    FAIL(-1, "操作失败" ),

    // 以1开头为共性类型
    PARAM_INVALID(10002, "参数无效"),
    PATH_UNFIND(10003, "请求路径不存在，请检查URL"),
    UNAUTHENTICATED(10004,"请登录后操作"),
    PARAM_REQUIRED(10005,"必须参数不全"),
    PARAM_JSON(10006,"参数转换异常"),
    UN_SERVICE(10007,"服务暂时不可用,稍等片刻..."),
    CHECK_MOBILE_EXIST(10008,"手机号已注册"),

    //2开头 账号操作相关
    TOKEN_NOT_VALID(2001, "token不合法" ),

    UN_ALIPAY_REALNAME(2002, "请完善支付宝和真实姓名" ),
    UN_AUTHORIZED(2003, "无权限" );





    /**
     * 枚举码
     */
    private final int code;
    /**
     * 枚举描述
     */
    private final String desc;

    ResultDataEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @Override
    public int code() {
        return code;
    }

    @Override
    public String desc() {
        return desc;
    }
}
